/**
* \brief Implementation of 'Abstract Factory' design pattern.
*	 Source file.
* \author Bartosz Kedra (bartosz.kedra@gmail.com)
*/
#include "ex4_2.hpp"

struct AbstractFactory 
{
public:
	virtual Residential* createResidential() = 0;
	virtual Shop* createShop() = 0;	
	~AbstractFactory() 
	{
		delete building;
		delete shop;	
	}
protected:
	Residential *building;
	Shop *shop;
};

template<typename BuildingType, typename ShopType>
struct ConcreteFactory : public AbstractFactory
{
	ConcreteFactory(const Color& c) 
	{
		building = new BuildingType(c);
		shop = new ShopType(c);
	}
	virtual Residential* createResidential() { return building->clone(); }
	virtual Shop* createShop() { return shop->clone(); }
};

typedef ConcreteFactory<class BlockOfFlats, class Grossery> Suburbs;
typedef ConcreteFactory<class Villa, class Market> HighLife;

int main()
{
	Suburbs suburbs(GREEN);
	HighLife highLife(BLUE);	

	return 1;
}




